﻿using System;
using System.Windows.Media.Media3D;
using HelixToolkit.Wpf;

namespace GameBoard
{
    public class TubeVisual : TubeVisual3D, IVisual, ITranslucentTerrain
    {
        bool _belongsToMoveablePicture = false;
        public bool BelongsToMoveablePicture
        {
            get { return _belongsToMoveablePicture; }
        }
        public void PopulateVisualData(BaseVisualData theData)
        {
            _belongsToMoveablePicture = theData.BelongsToMoveablePicture;
            FactoryID = theData.FactoryID;

            var tubeData = theData as TubeVisualData;
            Diameter = tubeData.Diameter;
            Material = tubeData.Material;
            TranslucentMaterialMaker.MakeMaterialsFromBrush(tubeData.MaterialBrush, this, tubeData.IsTransparent);
            Path = tubeData.Path;
            IsSolid = !tubeData.IsNotSolid;
        }

        public bool IsSolid
        {
            get;
            private set;
        }

        public ModelVisual3D VisualElement
        {
            get { return this; }
        }




        public Guid FactoryID
        {
            get;
            set;
        }

        private VisiblityType _opacity;
        public VisiblityType Opacity
        {
            get { return _opacity; }
            set
            {
                _opacity = value;
                TranslucentMaterialMaker.ChangeCurrentMaterialTo(this, _opacity);
            }
        }

        public DiffuseMaterial InvisibleMaterial { get; set; }
        public DiffuseMaterial VisibleMaterial { get; set; }
        public DiffuseMaterial TranslucentMaterial { get; set; }
    }
}